<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class UserAddRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
       return [
            'name' => 'required|max:255',
            'age' => 'required|max:255|numeric|min:1',
            'phone'=>'required|numeric',
            'sex'=>'required',
        ];
    }

    public function messages()
    {
         return [
            'name.required'=>'姓名不能为空',
            'age.required'=>'年龄不能为空',
            'age.numeric'=>'请输入正确年龄',
             'sex.required'=>'性别不能为空',
             'phone.required'=>'电话不能为空',
             'phone.numeric'=>'请输入正确电话号码',
             

        ];
    }
}
